-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fixed-hash and uint crates to parity-common #12
Conversation
* add rustc_version to build deps of ether types (needed by build script) * ethereum-types: add build script that sets cargo:rustc-cfg=asm_available on nightly * ethereum-types: #![cfg_attr(asm_available, feature(asm))] * tests: add the whole feature asm build script to make it pass on nightly CI * add #![cfg_attr(asm_available, feature(asm))] directly where needed so users don't have to add it * remove tests/build.rs since it should not be needed anymore * move inner cfg_attr attributes to the right allowed position * remove check for asm_available in contexts that already have check for that
* feature(asm) is only allowed in crate * add tests/build.rs again - haven't found a way around it
* feature(asm) is only allowed in crate * add tests/build.rs again - haven't found a way around it
I don't really get the reasoning for the move. The crate only exposes a macro to generate your own types, so it's only referenced by at most one crate.
None of the crates in this repo will ever dependend on IMHO we etiher keep |
Fix compiler warning Bump version
Fix wonky example causing long compile times
|
||
#[cfg(feature="std")] | ||
#[doc(hidden)] | ||
pub extern crate core; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are all these crates pub
?
implementations for even more speed, hidden behind the `x64_arithmetic` | ||
feature flag. | ||
|
||
Run tests with `cargo test --features=std,impl_quickcheck_arbitrary`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can I improve this? :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that and no, it's not really doing what I'd like. With:
[[test]]
name = "uint_tests"
required-features = ["std,impl_quickcheck_arbitrary"]
…I can run cargo test
and all tests are skipped which is better than spewing errors, but now cargo test --features=std,impl_quickcheck_arbitrary
also skips all tests.
What I'm looking for is a way to tell cargo "when running cargo test
use this set of features: … … ".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPDATE: seems to be a known limitation
Like @tomusdrw I am somewhat puzzled by this. Would the motivation behind |
Some of the code in
This is a great question and a concern I have too. The answer is, I guess, "we're disciplined about what we move". And "one could argue that The background conversation here is the tension between two valid but conflicting ergonomical concerns:
The |
uint/tests/uint_tests.rs
Outdated
fn uint256_mul32_old() { | ||
assert_eq!(U256::from(0u64).mul_u32(2), U256::from(0u64)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidentally duplicated line
Both
susbtrate
andethereum-types
usefixed-hash
to build their hash types so it's getting moved here.uint
is also moved as it is used in a few places insubstrate
.The new code here is from d2e4ec5 and fixes a compiler warning and adds a test.
One thing I am not happy with is that
uint
s tests have to be run withcargo test --features=std,impl_quickcheck_arbitrary
. Advice on how to fix that socargo test
works is much appreciated.